package com.shen.llmtool.modules.crc32.service;

import com.shen.llmtool.common.constant.CsvConstant;
import com.shen.llmtool.common.utils.CRC32Utils;
import com.shen.llmtool.common.utils.CsvFileUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * 标准化机构id生成crc32(机构名称)
 */
public class Crc32BuildService {
    public static void main(String[] args) {
        String csvReadFilePath = "E:\\city.csv";
        String csvWriteFilePath = "E:\\crc32.csv";
        List<String> jgmcList = CsvFileUtil.readCsvFile(csvReadFilePath);
        List<String[]> crc32HandleList = new ArrayList<>();
        for (String jgmc : jgmcList) {
            String[] record = new String[2];
            record[0] = jgmc;
            record[1] = CRC32Utils.crc32AsLong(jgmc).toString();
            crc32HandleList.add(record);
        }
        CsvFileUtil.writeCsvFile(csvWriteFilePath, crc32HandleList, CsvConstant.JGID_CSV_HEADER);
    }
}
